<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>微讯管理</title>
<link type="image/x-icon" rel="Shortcut Icon"
	href="<%=basePath%>Images/favicon.ico" />
<style type="text/css">
@import "<%=basePath%>CSS/Yiian_Style.css";
</style>
<link type="text/css" rel="stylesheet"
	href="<%=basePath%>CSS/Yiian_Include.css" />
<link type="text/css" rel="stylesheet"
	href="<%=basePath%>CSS/Yiian_MicroNews.css" />
<script type="text/javascript" language="javascript"
	src="<%=basePath%>JS/jquery-1.6.2.min.js"></script>
<script type="text/javascript">

	function getOauth(){
		window.location.href="<%=basePath%>oauth/getOauth.action?weixun.path=${weixun.path}";
	}
	
	$(function() {
		var weixinContent = $("#weixinContent");

		//发送消息 
		$("#sendMsg").click(
				function() {

					if($.trim(weixinContent.val()).length == 0){
						alert("请输入信息！");
						return ;
					}
					var params = {};
					params["message.content"] = weixinContent.val();

					$.ajax( {
						type : "post",
						url : "<%=basePath%>message/sendMessage.action",
						dataType : "json",
						data : params,
						success : function(_result) {
							if ("true" == _result.success) {
								weixinContent.val("");
								var xunxinDiv = $("#xunxiTemplate").clone();
								xunxinDiv.attr("id", Math.random());
								xunxinDiv.prependTo("#info1");
								xunxinDiv.prepend(params["message.content"]);
								//xunxinDiv.find("span[0]").prepend();
								var date = new Date();
								var sendData = "<font>" + (date.getMonth() + 1)
										+ "月" + date.getDate()
										+ "日&nbsp;&nbsp;&nbsp;"
										+ date.getHours() + ":"
										+ date.getMinutes()
										+ "&nbsp;&nbsp;&nbsp</font>";
								xunxinDiv.find("span:eq(0)").prepend(
										$(sendData));
								xunxinDiv.slideDown("slow");

								$("#msgcount").html(parseInt($("#msgcount").html()) + 1) ;

								//alert("发布信息成功");
							} else {
								alert("非法提交数据！");
							}
						},
						error : function() {
							alert("网络异常 ！");
						}
					});
				});

		var wordLimit = 140;
		//输入域绑定键盘按起事件
		weixinContent.bind("keyup", function() {
			var currentNum = wordLimit - weixinContent.val().length;
			if(currentNum < 0){
				weixinContent.val(weixinContent.val().substring(0,wordLimit));
				currentNum = 0;
			}
			$("#wordLimit").html(currentNum);
		});

	});
</script>
</head>
<body>
<div class="homeheader header">
  <div class="logo"><a href="http://www.wixun.com" title="微讯"><img
	src="<%=basePath%>Images/Logo.png" /> </a></div>
  <form action="searches.php" class="" id="" method="post" name="soso">
    <ul class="tool">
      <li class="search"><span class="bai">${sessionScope.user.username }</span>&nbsp;&nbsp;&nbsp;| <a class="nav" href="Tools.html">应用工具</a>| <a class="nav"
		href="Notice.html">我的私信(<span style="color: #FC0">12</span>)</a>| <a
		class="nav" href="Private.html">账户设置</a>| <a style="padding-right: 0;"
		class="nav" href="index.html">退出登录</a></li>
      <li style="padding-top: 9px; height: 21px;" class="search">
        <input
		type="text" class="sotxt txt" id="" name="" value="输入关键字搜索微讯" />
        <input
		type="button" class="sobtn" id="" name="" value="搜索" onClick="soso();" />
      </li>
    </ul>
  </form>
</div>
<div class="homemain">
  <div class="homeleft">
    <form action="Manager.html" class="fabu adpic" id="" method="post"
	name="">
      <h2 class="shuoshuo">有什么事想对大家说？</h2>
      <div class="xinxi"><img class="jiao1 jiao"
	src="<%=basePath%>Images/jiao1.jpg" /> <img class="jiao2 jiao"
	src="<%=basePath%>Images/jiao2.jpg" /> <img class="jiao3 jiao"
	src="<%=basePath%>Images/jiao3.jpg" /> <img class="jiao4 jiao"
	src="<%=basePath%>Images/jiao4.jpg" />
        <textarea class="wenzi"
	id="weixinContent"></textarea>
        <div class="gongju"><a class="tool1 txttool" href="#">话题</a><a
	class="tool2 txttool" href="#">行业</a><a class="tool3 txttool" href="#">圈内</a><a
	class="tool4 txttool" href="#">表情</a><a class="tool5 txttool" href="#">图片</a><a
	class="tool6 txttool" href="#">视频</a><a class="tool7 txttool" href="#">提问</a> <span class="zishu" id="wordLimit">140</span></div>
      </div>
      <div class="yijian">
      	
      	
        <div class="qunfa">
        
       	<c:if test="${!empty sessionScope.user.currentWeixun.accessToken}">
      		<a class="wei_1 weixin" href="#">&nbsp;</a>
      	</c:if>
       	<c:if test="${empty sessionScope.user.currentWeixun.accessToken}">
      		<a class="wei1 weixin" href="javascript:getOauth();">&nbsp;</a>
      	</c:if>
        <a
	class="wei2 weixin" href="#">&nbsp;</a><a class="wei3 weixin" href="#">&nbsp;</a><a
	class="wei4 weixin" href="#">&nbsp;</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a class="blue" href="#">编辑</a></div>
        <input type="button" class="fabubtn" id="sendMsg" />
      </div>
    </form>
    <div class="biaoqiao"><a class="xuanxiang" id="xuan1" href="#">我的讯息</a> </div>
    <div class="info" id="info1">
      <div class="xunxi bobao" id="xunxiTemplate" style="display: none;"><br />
        <span class="blue xiao"><font class="hui">来自</font>网页 </span> <span
	class="shoucang"> <a class="pinglun blue" href="">删除</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a
	class="pinglun blue" href="">评论</a> </span></div>
      <c:forEach var="message" items="${messageList}">
        <div class="xunxi bobao" id="xunxiTemplate">${message.content } <br />
          <span class="blue xiao">
          <fmt:formatDate
		value="${message.publishtime }" pattern="MM月dd日     HH:mm" />
          <font
		class="hui">来自</font>网页 </span> <span class="shoucang"> <a
		class="pinglun blue" href="">删除</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a
		class="pinglun blue" href="">评论</a> </span></div>
      </c:forEach>
      <div class="page"><span class="fenyishou fenyi">1</span><a
	class="fenyi" href="#">2</a><a class="fenyi" href="#">3</a><a
	class="fenyi" href="#">4</a><a class="fenyi" href="#">5</a><a
	class="fenyi" href="#">6</a>...... <a class="fenyi" href="#">30</a><a
	class="fenyi" href="#">下一页</a></div>
    </div>
  </div>
  <div class="manageright homeright">
    <div class="touxiang"><img class="ico icopic"
	src="<%=basePath%>upload/showImage.jsp?path=${weixun.logo}" />
      <div class="ziliao">
        <div class="wanzheng" style="width: 60px"></div>
        <span class="bili">60%</span></div>
    </div>
    <ul class="tongji">
      <li class="shuzi">${fn:length(followerList)}</li>
      <li class="mingchen">微友</li>
      <li class="fenline shuzi" id="msgcount">${fn:length(messageList)}</li>
      <li class="mingchen">微讯</li>
    </ul>
    <h3 class="name">${weixun.name }</h3>
    <a class="web" href="http://www.wixun.com/MicroNews.html?id=">http://www.wixun.com/${weixun.path }</a>
    <ul class="mywixun">
      <li class="menu0 menu">管理员： <span class="red">${sessionScope.user.username }</span><span
		class="hui xiao">&nbsp;<font class="blue">[</font>&nbsp;超级管理员&nbsp;<font
		class="blue">]</font>&nbsp;</span></li>
      <li class="tai menu5 menu">状态&nbsp;&nbsp;
        <input type="text"
		class="gongkai" id="zhuang" name="zhuangtai"
		onfocus="showAndHide('List','show');"
		onblur="showAndHide('List','hide');" value="设置状态" />
        <div class="xiala" id="List" style="display: none;">
          <div class="xuanze">
            <ul>
              <li onMouseDown="getValue('zhuang','公开');showAndHide('List','hide');"
			style="border-bottom: 1px dotted #666;">公开</li>
              <li onMouseDown="getValue('zhuang','隐私');showAndHide('List','hide');"> 隐私</li>
            </ul>
          </div>
        </div>
      </li>
      <li class="menu1 menu"><a class="caidan" href="Profile.html?id=">我的资料</a><span
		class="red">(60%)</span></li>
      <li class="menu6 menu"><a class="caidan" href="Members.html?id=">我的微讯成员</a><span
		class="red">(${fn:length(followerList)})</span></li>
      <li class="mywixun">
        <ul class="liebiao mywixun">
        
        <c:forEach var="item" items="${followerList}">
	        <li class="bu"></li>
	          <li class="tuwen"><a href="#" target="_blank"><img
				class="icopic" src="<%=basePath%>upload/showImage.jsp?path=${item.userpic}" /> </a><a
				class="myname" href="Material.html?id=" target="_blank">${item.username }</a></li>
			
      	</c:forEach>
          <li class="more"><a class="gengduo blue" href="Members.html?id=">更多<span
			class="songti">&nbsp;>></span> </a></li>
        </ul>
      </li>
    </ul>
  </div>
  <div style="clear: both; height: 0; font-size: 0;"></div>
</div>
<div class="copyright"><a class="links" href="#" target="_blank">帮助信息</a>- <a class="links" href="#" target="_blank">联系我们</a>- <a class="links"
	href="#" target="_blank">意见建议</a>- <a class="links" href="#"
	target="_blank">举报</a>- <a class="links" href="index.html">微讯首页</a> <br />
  Copyright&nbsp;&copy;&nbsp;2011&nbsp;&nbsp;Wixun.com&nbsp;&nbsp;Inc.&nbsp;&nbsp;All&nbsp;Rights&nbsp;Reserved.&nbsp;&nbsp;&nbsp;&nbsp;蛙扑公司&nbsp;&nbsp;&nbsp;&nbsp;版权所有 </div>
</body>
</html>
